home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / wnos / wn941101 / smtp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-10  |  2.9 KB  |  97 lines

  1. #ifndef    _SMTP_H
  2. #define    _SMTP_H
  3.  
  4. #define SMTPTRACE            /* enable tracing for smtp */
  5. #define MAXSESSIONS    10        /* most connections allowed */
  6. #define JOBNAME        13        /* max size of a job name with null */
  7. #define    LINELEN        256
  8. #define SLINELEN    64
  9. #define MBOXLEN        8        /* max size of a mail box name */
  10.  
  11. /* types of address used by smtp in an address list */
  12. typedef enum {
  13.     BADADDR         = 0,
  14.     LOCAL         = 1,
  15.     DOMAIN         = 2,
  16.     NNTP_GATE     = 3,
  17. } Mailtype;
  18.  
  19. /* a list entry */
  20. struct list {
  21.     struct list *next;
  22.     char *val;
  23.     Mailtype type;
  24. };
  25.  
  26. /* Per-session control block  used by smtp server */
  27. struct smtpsv {
  28.     int s;                        /* the socket for this connection */
  29.     char *system;                /* Name of remote system */
  30.     char *from;                    /* sender address */
  31.     struct list *to;            /* Linked list of recipients */
  32.     FILE *data;                    /* Temporary input file pointer */
  33. };
  34.  
  35. /* used by smtpcli as a queue entry for a single message */
  36. struct smtp_job {
  37.     struct smtp_job *next;        /* pointer to next mail job for this system */
  38.     char jobname[9];            /* the prefix of the job file name */
  39.     long len;                   /* length of file */
  40.     char *from;                    /* address of sender */
  41.     struct list *to;            /* Linked list of recipients */
  42. };
  43.  
  44. /* control structure used by an smtp client session */
  45. struct smtpcli {
  46.     int     s;                    /* connection socket */
  47.     int32    ipdest;                /* address of forwarding system */
  48.     char    *destname;            /* domain address of forwarding system */
  49.     char    *wname;                /* name of workfile */
  50.     char    *tname;                /* name of data file */
  51.     char    buf[LINELEN];        /* Output buffer */
  52.     char    cnt;                /* Length of input buffer */
  53.     FILE    *tfile;
  54.     struct    smtp_job *jobq;
  55.     struct    list     *errlog;
  56.     int lock;                    /* In use */
  57. };
  58.  
  59. /* smtp server routing mode */
  60. #define    QUEUE    1
  61.  
  62. #define    NULLLIST    (struct list *)0
  63. #define    NULLSMTPSV    (struct smtpsv *)0
  64. #define    NULLSMTPCLI    (struct smtpcli *)0
  65. #define NULLJOB        (struct smtp_job *)0
  66.  
  67. extern int Smtpmode;
  68. extern char *Mailspool;
  69. extern char *Maillog;
  70. extern char *Mailqdir;        /* Outgoing spool directory */
  71. extern char *Routeqdir;    /* spool directory for a router program */
  72. extern char *Mailqueue;    /* Prototype of work file */
  73. extern char *Maillock;        /* Mail system lock */
  74. extern char *Alias;        /* File of local aliases */
  75.  
  76. /* In smtpserv.c: */
  77. char *ptime __ARGS((int32 *t));
  78. long get_msgid __ARGS((void));
  79. char *getname __ARGS((char *cp));
  80. int validate_address __ARGS((char *s));
  81. int queuejob __ARGS((FILE *dfile,char *host,struct list *to,char *from));
  82. struct list *addlist __ARGS((struct list **head,char *val,int type));
  83. int mdaemon __ARGS((FILE *data,char *to,struct list *lp,int bounce));
  84.  
  85. /* In smtpcli.c: */
  86. int smtptick __ARGS((void *t));
  87. int _smtptick __ARGS((void *t));
  88. int mlock __ARGS((char *dir,char *id));
  89. int rmlock __ARGS((char *dir,char *id));
  90. void del_list __ARGS((struct list *lp));
  91. int32 mailroute __ARGS((char *dest));
  92.  
  93. extern char *Months[];
  94.  
  95. #endif    /* _SMTP_H */
  96.  
  97.